﻿using System.ComponentModel.DataAnnotations;
using System.Reflection.Metadata;
using System.Text.Json.Serialization;
using WcMatch.Utility;

namespace WcMatch.Models
{
    public partial class Student
    {
        [JsonIgnore]
        public string UName { get; set; }
        [JsonIgnore]
        public string HashedPwd { get; set; }

        public string? CitizenId { get;set; }

        public string? Name { get; set; }

        public string? Gender { get; set; }

        public string? EthnicGroups { get; set; }

        public string? ProvinceBorn { get; set; }

        public string? CityBorn { get; set; }

        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? EnrollmentYear { get; set; }

        [JsonConverter(typeof(DateTimeJsonConverter))]
        public DateTime? GraduationYear { get; set;}

        public string? College { get;set; }

        public string? Major { get; set; }

        public string? StuId { get; set; }

        public string? Degree { get; set;}

        public string? Phone { get;set; }

        public string? FamilyAddr { get; set; }
        [JsonIgnore]
        public string?  Photo { get; set; } = null;

        [Key]
        [JsonIgnore]
        public string Uid { get;set; }

        public Student(string uName, string pwd)
        {
            UName = uName;
            HashedPwd = pwd;
            EnrollmentYear = DateTime.Today;
            GraduationYear = DateTime.Today;
            Uid = Guid.NewGuid().ToString();
        }

        public Student() {
            Uid = Guid.NewGuid().ToString();
        }
    }
}
